In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Two players take part in the game polygons. A convex polygon with vertices divided by diagonals into triangles is necessary. These diagonals may intersect in vertices of the polygon only. One of the triangles is black and the remaining ones are white. Players proceed in alternate turns. Each player, when its turn comes, cuts away one triangle from the polygon. Players are allowed to cut off triangles along the given diagonals. The winner is the player who cuts away the black triangle.
NOTE: We call a polygon convex if a segment joining any two points of the polygon is contained in the polygon.
Write a program which:
The first line of the standard input contains an integer , . This is the number of vertices in the polygon. The vertices of the polygon are numbered, clockwise, from to . The next lines comprise descriptions of triangles in the polygon. In the -th line, , there are three non-negative integers , , separated by single spaces. Theses are numbers of vertices of the -th triangle. The first triangle in a sequence is black.
The standard output should have one line with the word:
For the input data:
6 0 1 2 2 4 3 4 2 0 0 5 4
the correct result is:
TAK
Task author: Grzegorz Jakacki.